package com.pointi.sysChecker;

import org.hyperic.sigar.SigarException;

public class sysChecker
{
	public static void main(String[] args) throws SigarException
	{
		String str_conffile = "sysChecker.conf";
		sysConfig conf_data = new sysConfig() ;
		conf_data.InitializeData();
		try
		{
			conf_data.ReadConfXML(str_conffile, conf_data);
			conf_data.WriteLogConfigurationData(conf_data);
		}
		catch (Exception e)
		{
			System.out.println("Can't Read XML File!! - "+str_conffile);
			e.printStackTrace();
		}
		
		boolean loop = true ;
		sysCPU cpu = new sysCPU() ;
		sysRAM ram = new sysRAM() ;
		while(loop)
		{
			sysLogManager.mLog(cpu.getCPU()) ;
			sysLogManager.mLog(ram.getRAM()) ;
			sysLogManager.printTXT(conf_data.s_file_path, "SYS_CPU", cpu.getCPU()) ;
			sysLogManager.printTXT(conf_data.s_file_path, "SYS_RAM", ram.getRAM()) ;
			sleep(500) ;
		}
	}
	public static void sleep(long t)
	{
		try { Thread.sleep(t) ; }
		catch(Exception e) { e.printStackTrace() ; }
	}
}
